package com.qjz.components
{
	import assets.skins.IconButtonSkin;
	
	import mx.events.FlexEvent;
	
	import spark.components.Button;
	
	[SkinState("selected")]
	
	public class IconButton extends Button
	{
		private var _selected:Boolean=false;
		
		public function IconButton()
		{
			super();
			this.setStyle("skinClass", IconButtonSkin);
		}
		
		public function get selected():Boolean
		{
			return _selected;
		}
		
		public function set selected(value:Boolean):void
		{			
			if (value == _selected)
				return;
			
			_selected = value;
			invalidateProperties();
		    invalidateSkinState();
		}
		
		override protected function getCurrentSkinState():String
		{
			if (!selected)
				return super.getCurrentSkinState();
			else
				return "selected";
		}
	}
}